import fetch from '@/utils/fetch'

//考核类型列表
export function getTypeList(params){
	return fetch({
		url:`/inspection/v1/mgt/type`,
		method:"get",
		params
	})
}

//新增考核类型
export function addType(data){
	return fetch({
		url:`/inspection/v1/mgt/type`,
		method:"post",
		data
	})
}

//修改考核类型
export function updateType(data,type_id){
	return fetch({
		url:`/inspection/v1/mgt/type/${type_id}`,
		method:"patch",
		data
	})
}

//考核类型详细
export function infoType(type_id){
	return fetch({
		url:`/inspection/v1/mgt/type/${type_id}`,
		method:"get"
	})
}

//删除考核类型
export function deleteType(type_id){
	return fetch({
		url:`/inspection/v1/mgt/type/${type_id}`,
		method:"delete"
	})
}

//标准列表
export function getStandardList(params){
	return fetch({
		url:`/inspection/v1/mgt/standard`,
		method:"get",
		params
	})
}

//新增标准
export function addStandard(data){
	return fetch({
		url:`/inspection/v1/mgt/standard`,
		method:"post",
		data
	})
}

//标准详细
export function infoStandard(st_id){
	return fetch({
		url:`/inspection/v1/mgt/standard/${st_id}`,
		method:"get"
	})
}

//删除标准
export function deleteStandard(st_id){
	return fetch({
		url:`/inspection/v1/mgt/standard/${st_id}`,
		method:"delete"
	})
}

//修改标准
export function updateStandard(data,st_id){
	return fetch({
		url:`/inspection/v1/mgt/standard/${st_id}`,
		method:"patch",
		data
	})
}

//人员规则详细
export function infoRule(st_id){
	return fetch({
		url:`/inspection/v1/mgt/rule`,
		method:"get"
	})
}

//人员规则编辑
export function updateRule(data){
	return fetch({
		url:`/inspection/v1/mgt/rule`,
		method:"patch",
		data
	})
}

//模板列表
export function getTemplateList(params){
	return fetch({
		url:`/inspection/v1/mgt/template`,
		method:"get",
		params
	})
}

//删除模板
export function deleteTemplate(template_id){
	return fetch({
		url:`/inspection/v1/mgt/template/${template_id}`,
		method:"delete"
	})
}

//新增模板
export function addTemplate(data){
	return fetch({
		url:`/inspection/v1/mgt/template`,
		method:"post",
		data
	})
}

//模板详细
export function infoTemplate(template_id){
	return fetch({
		url:`/inspection/v1/mgt/template/${template_id}`,
		method:"get"
	})
}

//修改模板
export function updateTemplate(data,template_id){
	return fetch({
		url:`/inspection/v1/mgt/template/${template_id}`,
		method:"patch",
		data
	})
}

//计划列表
export function getPlanList(params){
	return fetch({
		url:`/inspection/v1/mgt/plan`,
		method:"get",
		params
	})
}

//删除计划
export function deletePlan(plan_id){
	return fetch({
		url:`/inspection/v1/mgt/plan/${plan_id}`,
		method:"delete"
	})
}

//新增计划
export function addPlan(data){
	return fetch({
		url:`/inspection/v1/mgt/plan`,
		method:"post",
		data
	})
}

//计划详细
export function infoPlan(plan_id){
	return fetch({
		url:`/inspection/v1/mgt/plan/${plan_id}`,
		method:"get"
	})
}

//修改计划
export function updatePlan(data,plan_id){
	return fetch({
		url:`/inspection/v1/mgt/plan/${plan_id}`,
		method:"patch",
		data
	})
}

//任务列表
export function getTaskList(params){
	return fetch({
		url:`/inspection/v1/mgt/task`,
		method:"get",
		params
	})
}

//任务改派
export function reassignment(data,task_id){
	return fetch({
		url:`/inspection/v1/mgt/task/${task_id}`,
		method:"patch",
		data
	})
}

//整改任务改派
export function reassignmentDealer(data,rectify_id){
	return fetch({
		url:`/inspection/v1/mgt/rectify/dealer/${rectify_id}`,
		method:"patch",
		data
	})
}

//主线任务详情
export function infoMainTask(task_id){
	return fetch({
		url:`/inspection/v1/mgt/task/${task_id}`,
		method:"get"
	})
}

//主线标准列表
export function getDetailTaskList(params,task_id){
	return fetch({
		url:`/inspection/v1/mgt/detail/task/${task_id}`,
		method:"get",
		params
	})
}

//主线标准详细
export function infoDetailMainTask(detail_id){
	return fetch({
		url:`/inspection/v1/mgt/detail/${detail_id}`,//`/inspection/v2/mgt/detail/plan/${detail_id}`,
		method:"get"
	})
}

//标准详情下的整改任务列表
export function getRectifyDetailTaskList(detail_id){
	return fetch({
		url:`/inspection/v1/mgt/rectify/detail/${detail_id}`,
		method:"get" 
	})
}

//整改详细
export function infoRectifyDetailMainTask(rectify_id){
	return fetch({
		url:`/inspection/v1/mgt/rectify/${rectify_id}`,
		method:"get"
	})
}

//得分统计
export function getAverage(params){
	return fetch({
		url:`/inspection/v1/mgt/analysis/score`,
		method:"get",
		params
	})
}

//完成统计
export function getCompletion(params){
	return fetch({
		url:`/inspection/v1/mgt/analysis/completion`,
		method:"get",
		params
	})
}

//整改问题汇总
export function getSum(params){
	return fetch({
		url:`/inspection/v1/mgt/analysis/rectify/sum`,
		method:"get",
		params
	})
}

//整改共性问题
export function getCommon(params){
	return fetch({
		url:`/inspection/v1/mgt/analysis/rectify/common`,
		method:"get",
		params
	})
}

//整改重复发生问题
export function getDuplication(params){
	return fetch({
		url:`/inspection/v1/mgt/analysis/rectify/duplication`,
		method:"get",
		params
	})
}

//立即创建计划内任务
export function createTask(plan_id){
	return fetch({
		url:`/inspection/v1/mgt/task/${plan_id}`,
		method:"post"
	})
}

//查询项目列表
export function getSubtypeList(params){
	return fetch({
		url:`/inspection/v1/mgt/subtype/search`,
		method:"get",
		params
	})
}

//新增项目列表
export function addSubtype(data){
	return fetch({
		url:`/inspection/v1/mgt/subtype`,
		method:"post",
		data
	})
}

//修改项目
export function updateSubtype(data){
	return fetch({
		url:`/inspection/v1/mgt/subtype`,
		method:"patch",
		data
	})
}

//项目详细
export function infoSubType(type_id){
	return fetch({
		url:`/inspection/v1/mgt/subtype/${type_id}`,
		method:"get"
	})
}

//删除项目
export function deleteSubType(type_id){
	return fetch({
		url:`/inspection/v1/mgt/subtype/${type_id}`,
		method:"delete"
	})
}

//任务信息
export function infoPlanTask(plan_id,params){
	return fetch({
		url:`/inspection/v2/mgt/plan/tasks/${plan_id}`,
		method:"get",
		params
	})
}

//任务检查项归类列表
export function getDetailPlanList(plan_id,params){
	return fetch({
		url:`/inspection/v2/mgt/detail/plan/${plan_id}`,
		method:'get',
		params
	})
}

//编辑检查结果
export function updateDetail(detail_id,data){
	return fetch({
		url:`/inspection/v1/mgt/detail/${detail_id}`,
		method:'patch',
		data
	})
}

//删除检查结果记录
export function deleteDetail(detail_id){
	return fetch({
		url:`/inspection/v1/mgt/detail/${detail_id}`,
		method:'delete'
	})
}

//提交职能任务
export function subCommit(plan_id){
	return fetch({
		url:`/inspection/v2/mgt/plan/commit/${plan_id}`,
		method:'post'
	})
}

//主线标准列表v2
export function getDetailTaskListV2(params,task_id){
	return fetch({
		url:`/inspection/v2/mgt/detail/task/${task_id}`,
		method:"get",
		params
	})
}

//导出excel表头字段映射
export const excelKey={
	area_name:"考核区域",
	commit_time:"完成时间",
	dealer_id:"处理人id",
	dealer_name:"处理人",
	dealer_phone:"处理人电话",
	detail_address:"考核地址",
	detail_img:"图片信息",
	detail_info:"文字说明",
	detail_result:"考核结论",
	detail_focus:"考核重点",
	is_necessary:"是否必检",
	plan_id:"计划id",
	rectify_days:"整改天数",
	score:"加/扣分项",
	st_content:"考核内容",
	st_id:"标准id",
	st_info:"考核标准说明",
	st_no:"标准代码",
	status:"状态",
	subtype_id:"考核项目id",
	subtype_name:"考核项目",
	task_id:"任务id",
	type_id:"考核类型id",
	type_name:"考核类型名称",
	st_tag:"不合格标签",
	detail_id:"id"
}